<!DOCTYPE html>
<!--suppress ThymeleafVariablesResolveInspection-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}" media="all" />
    <script th:src="@{/layui/layui.js}"></script>
    <script th:src="@{/js/register/jquery-3.1.0.min.js}"></script>
</head>
<style>
    ::-webkit-scrollbar {display:none}/*隐藏横向滚动条但可以滚动*/
</style>
<body>
<form class="layui-form">

    <div class="layui-form-item" style="margin-top: 20px">
        <label class="layui-form-label">学生姓名</label>
        <div class="layui-input-inline">
            <input  name="stuname" required lay-verify="required" placeholder="请输入学生姓名" autocomplete="off" class="layui-input"/>
        </div>

        <label class="layui-form-label">身份证号</label>
        <div class="layui-input-inline">
            <input  name="cardid" required lay-verify="required" placeholder="请输入身份证号" autocomplete="off" class="layui-input"/>
        </div>

        <label class="layui-form-label">担保人</label>
        <div class="layui-input-inline">
            <input  name="guarantee" required lay-verify="required" placeholder="请输入担保人" autocomplete="off" class="layui-input"/>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">毕业学校</label>
        <div class="layui-input-inline">
            <input  name="middleschool" required lay-verify="required" placeholder="请输入毕业学校" autocomplete="off" class="layui-input"/>
        </div>

        <label class="layui-form-label">性别</label>
        <div class="layui-input-inline">
            <input type="radio" name="sex" value="男" title="男" checked>
            <input type="radio" name="sex" value="女" title="女">
        </div>
        <label class="layui-form-label">民族</label>
        <div class="layui-input-inline">
            <input  name="nation" required lay-verify="required" placeholder="请输入民族" autocomplete="off" class="layui-input"/>
        </div>

    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">年龄</label>
        <div class="layui-input-inline">
            <input  name="age" required lay-verify="required" placeholder="请输入年龄" autocomplete="off" class="layui-input"/>
        </div>
        <label class="layui-form-label">出生年月</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" id="test2" name="birthday" required lay-verify="required" placeholder="请输入出生年月"/>
        </div>

        <label class="layui-form-label">学生电话</label>
        <div class="layui-input-inline">
            <input  name="phone" required lay-verify="required" placeholder="请输入学生电话" autocomplete="off" class="layui-input"/>
        </div>


    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">家庭地址</label>
        <div class="layui-input-inline">
            <input  name="addr" placeholder="请输入家庭地址" autocomplete="off" class="layui-input"/>
        </div>
        <label class="layui-form-label">入学时间</label>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" id="test1" name="entertime" placeholder="请输入入学时间">
        </div>

        <label class="layui-form-label">户口性质</label>
        <div class="layui-input-inline">
            <select name="residence">
                <option value="农村户口">农村户口</option>
                <option value="城镇户口">城镇户口</option>
            </select>
        </div>


    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">籍贯</label>
        <div class="layui-input-inline">
            <input id="natives" name="natives" placeholder="请输入籍贯" autocomplete="off" class="layui-input"/>
        </div>
        <label class="layui-form-label">专业类别</label>
        <div class="layui-input-inline">
            <select id="themes" name="prolevel">
                <option value="">请选择</option>
                <option th:each="l:${classtypeList}"th:value="${l.classtypename}" th:text="${l.classtypename}"></option>
            </select>
        </div>

        <label class="layui-form-label">学习类别</label>
        <div class="layui-input-inline">
            <select name="studytype">
                <option value="全日制">全日制</option>
                <option value="函授">函授</option>
            </select>
        </div>


    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">家长姓名</label>
        <div class="layui-input-inline">
            <input  name="parents" required lay-verify="required" placeholder="请输入家长姓名" autocomplete="off" class="layui-input"/>
        </div>
        <label class="layui-form-label">家长电话</label>
        <div class="layui-input-inline">
            <input  name="parentsphone" required lay-verify="required" placeholder="请输入家长电话" autocomplete="off" class="layui-input"/>
        </div>

        <label class="layui-form-label">老师电话</label>
        <div class="layui-input-inline">
            <input  name="teacherphone" required lay-verify="required" autocomplete="off" class="layui-input"/>
        </div>


    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">面试人</label>
        <div class="layui-input-inline">
            <input  name="audition" required lay-verify="required" autocomplete="off" class="layui-input"/>
        </div>
        <label class="layui-form-label">是否中专</label>
        <div class="layui-input-inline">
            <input type="radio" name="isvocational" value="是" title="是"checked>
            <input type="radio" name="isvocational" value="否" title="否">
        </div>

        <label class="layui-form-label">中专学校</label>
        <div class="layui-input-inline">
            <input  name="vocationalsch" required lay-verify="required" placeholder="请输入中专学校" autocomplete="off" class="layui-input"/>
        </div>


    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">中专学籍</label>
        <div class="layui-input-inline">
            <select name="vocationalflag">
                <option value="已退">已退</option>
                <option value="保留">保留</option>
            </select>
        </div>
        <label class="layui-form-label">省录取号</label>
        <div class="layui-input-inline">
            <input  name="enrollno" required lay-verify="required" autocomplete="off" class="layui-input"/>
        </div>

        <label class="layui-form-label">面试人意见</label>
        <div class="layui-input-inline">
            <input  name="auditionoption" required lay-verify="required" autocomplete="off" class="layui-input"/>
        </div>


    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">学号</label>
        <div class="layui-input-inline">
            <input  name="stuno" required lay-verify="required" placeholder="请输入学号" autocomplete="off" class="layui-input"/>
        </div>
        <label class="layui-form-label">报名号</label>
        <div class="layui-input-inline">
            <input  name="registration" required lay-verify="required" autocomplete="off" class="layui-input"/>
        </div>

        <label class="layui-form-label">低保</label>
        <div class="layui-input-inline">
            <select name="dibao">
                <option value="">是</option>
                <option value="">否</option>
            </select>
        </div>


    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">生源类型</label>
        <div class="layui-input-inline">
            <select name="sourcetype">
                <option value="普通生源">普通生源</option>
            </select>
        </div>
        <label class="layui-form-label">备注</label>
        <div class="layui-input-inline">
            <input  name="remark" required lay-verify="required" autocomplete="off" class="layui-input"/>
        </div>

    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">入学班级</label>
        <div class="layui-input-inline">
            <select lay-filter="selectTheme" id="board" name="jiebie">-->
                <option value="0" >请选择届别</option>
                <option  th:each="sf:${studentfallList}" th:value="${sf.fallid}" th:text="${sf.level}">所在系</option>
            </select>

        </div>
        <div class="layui-input-inline">
            <select id="theme" name="clazz">
                <option></option>
            </select>
        </div>
    </div>

    <div class="layui-form-item" style="margin-left: 275px">
        <label class="layui-form-label"></label>
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重新填写</button>
        </div>
    </div>
</form>
</body>
<script th:src="@{/layui/layui.js}"></script>
<script type="text/javascript" th:inline="none">

    layui.use('form', function(){
        var form = layui.form;


        $("#add").on('click',function(){
            layer.open({
                type: 2,
                title: '籍贯新增',
                maxmin: true, //开启最大化最小化按钮
                area: ['400px', '200px'],
                content: ['/stu/ll']//这是链接你的页面地址 url
            });
        })

        form.on('select(selectTheme)', function (data) {//对应lay-filter="selectTheme"
            var index1 = $('#board option:selected').val();//对应id="board"  得到一级菜单选中值的value
            var optionJson = [];
            $.ajax({
                url: "/stu/byfallid",//对应controller层
                type: "post",
                data: {"classno": index1},//将选中值的value传给controller
                datatype: "json",
                success: function (data) {
                    optionJson = data;
                    var selectObj = document.getElementById("theme");//对应id="theme"
                    selectObj.options.length = 0;
                    for (var i = 0; i < data.length; i++) {
                        selectObj.add(new Option(optionJson[i].classname, optionJson[i].classid));//对应数据库中名字，两个参数是(文本,value)
                    }
                    form.render();
                }
            })
        });


        //监听提交
        //你可以在这里做操作  也可以不使用这个方法
        form.on('submit(formDemo)', function(data){
            $.ajax({
                url: '/stu/add',
                type: 'post',
                data:data.field,
                dataType: 'json',
                success:function(data){
                    if(data){
                        layer.msg(JSON.stringify("添加成功"));
                        //先得到当前iframe层的索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //再执行关闭
                        parent.layer.close(index);
                        window.parent.location.reload();
                    }
                },
            })
            //$('.layui-laypage-btn').click();//刷新
            return false;
        });
    });

    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test1' //指定元素
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#test2' //指定元素
        });
    });
</script>
</html>